package com.mezz.bones.im.gateway.manager;

import com.mezz.bones.im.gateway.attr.ChannelAttributes;
import io.netty.channel.ChannelHandlerContext;
import org.springframework.stereotype.Component;

/**
 * @Author: zhuang
 * @Date: 2024/12/2 17:42
 * @Description: TODO
 * @Version: 1.0
 **/

@Component
public class UserIpManager {

    //设置用户初始化完成标记
    public void setIp(ChannelHandlerContext ctx,String ip) {
        ctx.channel().attr(ChannelAttributes.USER_IP).set(ip);
    }

    //是否是握手阶段
    public String getIp(ChannelHandlerContext ctx) {
        return ctx.channel().attr(ChannelAttributes.USER_IP).get();
    }
}
